package com.cqapp.widget.ui.image;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;


public class ImagePagerAdapter extends FragmentPagerAdapter {

    //设置滑动fragment的数量
    private final int PAGER_COUNT = 3;


    private  List<Fragment> mfragmentList;

    public ImagePagerAdapter(@NonNull FragmentManager fm, List<Fragment> fragmentList) {
        super(fm);
        mfragmentList = fragmentList;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        System.out.println("position Destory" + position);
        super.destroyItem(container, position, object);
    }


    @NonNull
    @Override
    public Fragment getItem(int position) {

        return mfragmentList.get(position);
    }

    @Override
    public int getCount() {
        return PAGER_COUNT;
    }
}
